import { Body, Controller, Delete, Get, Param, Patch, Post } from "@nestjs/common";
import { MongoService } from "./mongo.service";
import { CreateCatDto } from "./dto/create-cat.dto";
import { UpdateCatDto } from "./dto/update-cat.dto";

/**
 * MongoController
 *
 * 提供简单的 RESTful 路由占位，便于后续调试 MongoDB 逻辑。
 */
@Controller("mongo")
export class MongoController {
  constructor(private readonly mongoService: MongoService) {}

  /**
   * GET /mongo
   */
  @Get()
  findAll() {
    return this.mongoService.findAll();
  }

  /**
   * GET /mongo/:id
   */
  @Get(":id")
  findOne(@Param("id") id: string) {
    return this.mongoService.findOne(id);
  }

  /**
   * POST /mongo
   */
  @Post()
  create(@Body() payload: CreateCatDto) {
    return this.mongoService.create(payload);
  }

  /**
   * PATCH /mongo/:id
   */
  @Patch(":id")
  update(@Param("id") id: string, @Body() payload: UpdateCatDto) {
    return this.mongoService.update(id, payload);
  }

  /**
   * DELETE /mongo/:id
   */
  @Delete(":id")
  remove(@Param("id") id: string) {
    return this.mongoService.remove(id);
  }
}
